package com.xin.di.uav.common.enums;

import lombok.Getter;
import org.springframework.util.ObjectUtils;

@Getter
public enum PaymentMethodEnum {
    TC_MONTHLY_SETTLEMENT(1, "同城月结"),
    DW_MONTHLY_SETTLEMENT(3, "大网月结"),
    BALANCE_PAYMENT(4, "余额支付");


    PaymentMethodEnum(Integer code, String name) {
        this.code = code;
        this.name = name;
    }

    private Integer code;
    private String name;

    public static String getName(Integer code) {
        for (PaymentMethodEnum ele : values()) {
            if (ele.getCode().equals(code)) {
                return ele.getName();
            }
        }
        return null;
    }

    public static Boolean containsByCode(Integer code) {
        if (code == null) {
            return Boolean.FALSE;
        }
        for (PaymentMethodEnum value : values()) {
            if (value.getCode().equals(code)) {
                return Boolean.TRUE;
            }
        }
        return Boolean.FALSE;
    }
}
